const global = getApp().globalData;

const sysInfo = {
  get( fn ) {
    let self = this;
    if ( global.sysInfo ) {
      return global.sysInfo;
    }
    wx.getSystemInfo({
      success( info ) {
        self.infoModel( info );
      },
      fail( err ) {

      }
    })
  },
  infoModel( info ) {
    let obj = {
      sdk: {
        p: 'Wechat Mini Program',
        v: info.SDKVersion
      },
      app: {
        c: '',
        v: ''
      },
      sys: {
        os: info.system || '',
        osv: info.system || '',
        lng: info.language || '',
        ctry: info.language || ''
      }
    }
    return null;
  }
}